<?php
namespace app\superadmin\controller;
use app\superadmin\model\Index as IndexModel;
//继承Base控制器
class Food extends Base
{
    public function foodlist()
    {
       $foodres= \think\Db::name('food')
             ->alias('a')
             ->join('__DINING__ b', 'a.shop_id =b.shop_id')
             ->field('a.food_id,a.foodname,a.type_id,a.price,a.state,a.recommand,a.isspecial,a.specialprice,a.startdate,a.enddate,a.fee,a.intro,b.shopname,a.pic')
             ->where('a.shop_id =b.shop_id')
             ->paginate(4);
       $this->assign('foodres',$foodres);
      return $this->fetch();
    } 

    public function delfood(){
      $food_id=input('food_id');
      if(db('food')->delete($food_id)){
        return $this->success('删除成功！','foodlist');
      }else{
        return $this->error('删除失败！','foodlist');
      }
    }


   
}
